<script setup>
import { ref } from 'vue'
import {
  MoveUp,
  MoveDown,
  MoveStop,
  CameraCapture,
  CaptureWithGlass
} from "../../wailsjs/go/api/CameraApi.js";
const canCapture = ref(false)
const upMachine = () => {
  MoveUp()
  console.log('Start Machine')
}

const pause = async () => {
  const res = await MoveStop()
  if (res.code === 0){
    canCapture.value = true
  }else {
    canCapture.value = false
  }
  console.log('Device Pause',res)
}

const downMachine = () => {
  MoveDown()
  console.log('Stop Machine')
}

const cameraCaptureing = async () => {
  const res = await CameraCapture()
  console.log("CameraCapture",res)
}

const captureWithGlassing = async () => {
  const res = await CaptureWithGlass()
  console.log("CaptureWithGlass",res)
}
</script>

<template>
  <div class="flex flex-col items-center">
    <button @click="upMachine" style="margin: 10px">UpMachine</button>
    <button @click="pause"  style="margin: 10px">Pause</button>
    <button @click="downMachine"  style="margin: 10px">DownMachine</button>
    <button @click="cameraCaptureing"  :style="{ backgroundColor: canCapture ? 'green' : 'gray'}"  >CameraCapture</button>
    <button @click="captureWithGlassing"  style="margin: 10px">CaptureWithGlass</button>
  </div>
  <div>
  </div>
</template>


<style scoped lang="scss">

</style>